-
Notifications
You must be signed in to change notification settings - Fork 165
[terra-arrange][terra-section-header] update to utilize semantic html elements #3831
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may need to update jest snapshots as well.
packages/terra-arrange/CHANGELOG.md
Outdated
@@ -2,6 +2,9 @@ | |||
|
|||
## Unreleased | |||
|
|||
* Changed | |||
* Updated div elements with span tag elements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Updated div elements with span tag elements. | |
* Updated Arrange to use `span` elements instead of `div`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
* Added | ||
* Added a function "ArrangeComponent" to use Arrange component. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CHANGELOGs are for consumers so we don't have to add entries for internal implementation changes.
* Added | |
* Added a function "ArrangeComponent" to use Arrange component. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed these 2 lines.
* Updated div element with span tag element. | ||
* Updated div element with button tag element. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Updated div element with span tag element. | |
* Updated div element with button tag element. | |
* Updated SectionHeader to use `span` & `button` elements instead of `div`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
.fit-block { | ||
.icon-wrapper { | ||
display: inline-flex; | ||
font-size: 8px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these style values provided by UX..??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, these are not provided by UX team. I have added them to match the existing look of UI. If required i will check with UX team.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes we need UX review for the above style changes !!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got +1 from UX
</div> | ||
<div {...fillProps} className={cx('fill', align || alignFill, fillProps.className)}> | ||
</span> | ||
<span {...fillProps} className={cx('fill', align || alignFill, fillProps.className || 'fill-block')}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<span {...fillProps} className={cx('fill', align || alignFill, fillProps.className || 'fill-block')}> | |
<span {...fillProps} className={cx('fill', align || alignFill, fillProps.className, 'fill-block')}> |
why are using || here with fillProps.classname ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed that || operator as it's not required here.
@@ -37,3 +37,16 @@ | |||
align-self: flex-start; | |||
} | |||
} | |||
|
|||
.fit-block { | |||
.icon-wrapper { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this class intended for terra-arrange ? there are no reference in Arrange component for class icon-wrapper
!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class has been added in section header component, i have moved these styles into section header module scss file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rebase with main so that this file is up to date?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
const ArrangeComponent = () => ( | ||
<Arrange | ||
fitStart={onClick && accordionIcon} | ||
fill={<span aria-hidden={(onClick !== undefined)} className={cx('title', 'title-block')}>{headerText}</span>} | ||
className={cx('title-arrange')} | ||
/> | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be a variable instead of a function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this function and added Arrange component directly inside ArrangeWrapperTag as part of latest updates.
/> | ||
); | ||
|
||
const buttonAttributes = (onClick) ? { 'aria-expanded': isOpen, 'aria-label': headerText } : undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these still needed? Should aria-expanded': isOpen
be set on the <button>
and 'aria-label': headerText
be set on the <span>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized I misread this. I don't think we need the ternary anymore since we can set { 'aria-expanded': isOpen, 'aria-label': headerText }
directly on the <button>
.
<button {...buttonAttributes} type="button" tabIndex="-1" className={cx('arrange-wrapper toggle-button')}> | ||
<ArrangeComponent /> | ||
</button> | ||
) : ( | ||
<span tabIndex="-1" className={cx('arrange-wrapper')}> | ||
<ArrangeComponent /> | ||
</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both of these seem very similar so instead of defining these twice, we can do something like:
const ArrangeWrapperTag = onClick ? "button" : "span" ;
const type = onClick ? "button" : null;
// ... and so on for the other attributes
<ArrangeWrapperTag (attributes) >
<ArrangeComponent />
</ArrangeWrapperTag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
3314e7b
to
ae58b44
Compare
* Added | ||
* Added realistic examples for `terra-arrange`. | ||
* Added realistic examples for `terra-toggle-section-header`. | ||
|
||
* Added | ||
* Added email validation for `terra-form-field`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's combine the Added sections:
* Added | |
* Added realistic examples for `terra-arrange`. | |
* Added realistic examples for `terra-toggle-section-header`. | |
* Added | |
* Added email validation for `terra-form-field`. | |
* Added | |
* Added realistic examples for `terra-arrange`. | |
* Added realistic examples for `terra-toggle-section-header`. | |
* Added email validation for `terra-form-field`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
@@ -40,7 +47,6 @@ | |||
* Added | |||
* Added terra-scroll A11y tests. | |||
* Added an example in terra-content-container without interactive elements. | |||
* Added examples for terra-content-container with dark colors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This entry was now Added.
@@ -4,7 +4,7 @@ | |||
[![NPM version](https://badgen.net/npm/v/terra-toggle-section-header)](https://www.npmjs.org/package/terra-toggle-section-header) | |||
[![Build Status](https://badgen.net/travis/cerner/terra-core)](https://travis-ci.com/cerner/terra-core) | |||
|
|||
Toggle section header component that transitions content in and out with a click. | |||
Toggle section header component that transitions content in and out with a click. For accessibility best practices, it is recommended that consumers should always use only one h1 tag per page or view. The one h1 tag should be the page title. A section header should never be a heading level 1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is already in the terra-toggle-section-header About
doc, can we remove it from the README? Consumers don't generally refer to the README for component guidance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
… elements (#3831) Co-authored-by: ST063655 <ST063655@cerner.net>
Summary
Currently Toggle Section Header wraps a H2 with a button which might not be valid HTML. While the screen reader does read and interpret code correctly, the invalid code could fail for other browsers or assistive technologies. Added valid html to avoid these failures.
What was changed:
Updated HTML code div elements with button and span tags to make it valid html.
Why it was changed:
To avoid failures of invalid html on other browsers or assistive technologies.
This PR resolves:
UXPLATFORM-9093
Thank you for contributing to Terra.
@cerner/terra